<template>
  <div id="app">
    <nav-header v-if="Object.keys(user).length!==0"></nav-header>
    <router-view></router-view>
  </div>
</template>

<script>
import NavHeader from "components/navheader/NavHeader";
import { mapState } from 'vuex';
export default {
  name: "App",
  created () {
    sessionStorage.getItem('pc') && this.$store.replaceState(Object.assign(this.$store.state, JSON.parse(sessionStorage.getItem('pc'))))

    window.addEventListener('beforeunload', () => {
      sessionStorage.setItem('pc', JSON.stringify(this.$store.state))
    })
  },
  computed: {
    ...mapState(['user'])
  },
  components: {
    NavHeader
  }
};
</script>>

<style>
</style>
 